package com.ruoyi.web.controller.rgpp;

import java.util.List;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import com.ruoyi.common.annotation.Log;
import com.ruoyi.common.enums.BusinessType;
import com.ruoyi.rgpp.domain.JmrypjyzdStudents;
import com.ruoyi.rgpp.service.IJmrypjyzdStudentsService;
import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.utils.poi.ExcelUtil;
import com.ruoyi.common.core.page.TableDataInfo;

/**
 * 学生简历信息Controller
 * 
 * @author ruoyi
 * @date 2022-06-15
 */
@Controller
@RequestMapping("/rgpp/JmrypjyzdStudents")
public class JmrypjyzdStudentsController extends BaseController
{
    private String prefix = "rgpp/JmrypjyzdStudents";

    @Autowired
    private IJmrypjyzdStudentsService jmrypjyzdStudentsService;

    @RequiresPermissions("rgpp:JmrypjyzdStudents:view")
    @GetMapping()
    public String JmrypjyzdStudents()
    {
        return prefix + "/JmrypjyzdStudents";
    }

    /**
     * 查询学生简历信息列表
     */
    @RequiresPermissions("rgpp:JmrypjyzdStudents:list")
    @PostMapping("/list")
    @ResponseBody
    public TableDataInfo list(JmrypjyzdStudents jmrypjyzdStudents)
    {
        startPage();
        List<JmrypjyzdStudents> list = jmrypjyzdStudentsService.selectJmrypjyzdStudentsList(jmrypjyzdStudents);
        return getDataTable(list);
    }

    /**
     * 导出学生简历信息列表
     */
    @RequiresPermissions("rgpp:JmrypjyzdStudents:export")
    @Log(title = "学生简历信息", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    @ResponseBody
    public AjaxResult export(JmrypjyzdStudents jmrypjyzdStudents)
    {
        List<JmrypjyzdStudents> list = jmrypjyzdStudentsService.selectJmrypjyzdStudentsList(jmrypjyzdStudents);
        ExcelUtil<JmrypjyzdStudents> util = new ExcelUtil<JmrypjyzdStudents>(JmrypjyzdStudents.class);
        return util.exportExcel(list, "学生简历信息数据");
    }

    /**
     * 新增学生简历信息
     */
    @GetMapping("/add")
    public String add()
    {
        return prefix + "/add";
    }

    /**
     * 新增保存学生简历信息
     */
    @RequiresPermissions("rgpp:JmrypjyzdStudents:add")
    @Log(title = "学生简历信息", businessType = BusinessType.INSERT)
    @PostMapping("/add")
    @ResponseBody
    public AjaxResult addSave(JmrypjyzdStudents jmrypjyzdStudents)
    {
        return toAjax(jmrypjyzdStudentsService.insertJmrypjyzdStudents(jmrypjyzdStudents));
    }

    /**
     * 修改学生简历信息
     */
    @RequiresPermissions("rgpp:JmrypjyzdStudents:edit")
    @GetMapping("/edit/{card}")
    public String edit(@PathVariable("card") String card, ModelMap mmap)
    {
        JmrypjyzdStudents jmrypjyzdStudents = jmrypjyzdStudentsService.selectJmrypjyzdStudentsByCard(card);
        mmap.put("jmrypjyzdStudents", jmrypjyzdStudents);
        return prefix + "/edit";
    }

    /**
     * 修改保存学生简历信息
     */
    @RequiresPermissions("rgpp:JmrypjyzdStudents:edit")
    @Log(title = "学生简历信息", businessType = BusinessType.UPDATE)
    @PostMapping("/edit")
    @ResponseBody
    public AjaxResult editSave(JmrypjyzdStudents jmrypjyzdStudents)
    {
        return toAjax(jmrypjyzdStudentsService.updateJmrypjyzdStudents(jmrypjyzdStudents));
    }

    /**
     * 删除学生简历信息
     */
    @RequiresPermissions("rgpp:JmrypjyzdStudents:remove")
    @Log(title = "学生简历信息", businessType = BusinessType.DELETE)
    @PostMapping( "/remove")
    @ResponseBody
    public AjaxResult remove(String ids)
    {
        return toAjax(jmrypjyzdStudentsService.deleteJmrypjyzdStudentsByCards(ids));
    }
}
